Skip to content

fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#45

Merged
KailasMahavarkar merged 1 commit intomainfrom
fix/design-tokens-gotchas
Apr 11, 2026
Merged

fix(design-tokens): add gotchas for @theme var resolution and default mode inversion#45
KailasMahavarkar merged 1 commit intomainfrom
fix/design-tokens-gotchas

Conversation

@KailasMahavarkar
Copy link
Copy Markdown
Collaborator

Two production-critical gotchas added to the design-tokens plugin:

  1. @theme does NOT emit CSS custom properties on :root — If :root uses var(--color-brand-400) and that value is only defined in @theme, the var() resolves to undefined at runtime, making all text/backgrounds white. Correct architecture: raw OKLCH values on :root and .dark, @theme inline bridges to utilities.

  2. Respect aesthetic direction before inverting defaults — If a codebase uses dark backgrounds with light text everywhere, dark IS the default. Setting :root to light values breaks 90% of text until every component is migrated.

… mode inversion

- @theme generates Tailwind utilities, NOT CSS custom properties on :root.
  If :root references var() values only defined in @theme, they resolve to
  undefined at runtime — all text/backgrounds go white.
- Before refactoring a site's color system, verify its existing aesthetic
  direction. Dark-first sites break if :root is set to light values.
@KailasMahavarkar KailasMahavarkar merged commit c686590 into main Apr 11, 2026
4 checks passed
KailasMahavarkar added a commit that referenced this pull request Apr 14, 2026
fix(design-tokens): add gotchas for @theme var resolution and default mode inversion
@KailasMahavarkar KailasMahavarkar deleted the fix/design-tokens-gotchas branch April 14, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant